//
// Created by Administrator on 2023/2/9.
//

#ifndef MAIN_USERCFG_H
#define MAIN_USERCFG_H
/*C头文件*/
#include <malloc.h>
#include <math.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
/*配置与Freertos*/
#include "freertos/FreeRTOS.h"
#include "freertos/event_groups.h"
#include "freertos/semphr.h"
#include "freertos/task.h"
#include "sdkconfig.h"

/*乐鑫头文件*/
#include "esp32s3/rom/ets_sys.h"
#include "esp_freertos_hooks.h"
#include "esp_intr_alloc.h"
#include "esp_system.h"

#include "sys/unistd.h"
#include <esp_err.h>
#include <esp_log.h>
#include <sys/param.h>

typedef unsigned char u8;
typedef unsigned short u16;
typedef unsigned int u32;

#define LDO1_ENABLE 0
#define LDO2_ENABLE 1
#define LDO3_ENABLE 1
#define LDO4_ENABLE 1
#define DCDC1_ENABLE 1
#define DCDC2_ENABLE 0

#define LDO2_VOL 3000
#define LDO3_VOL 2800
#define LDO4_VOL 3300
#define DCDC1_VOL 3300

#define AXP173_IIC_ADDR 0x34
#define MPU6050_IIC_ADDR 0x68
#define HP203B_IIC_ADDR 0x77

#define AXP173_IQR_PIN GPIO_NUM_37
#define MPU6050_IQR_PIN GPIO_NUM_38
#define HP203B_IQR_PIN GPIO_NUM_1

#if 0
#define common_sda GPIO_NUM_33
#define common_scl GPIO_NUM_34 // // smartwatch_v3_1
#else
#define common_sda GPIO_NUM_35
#define common_scl GPIO_NUM_36 // smartwatch_v3_0/v3_2
#endif

#define common_i2c_num I2C_NUM_0
#define common_i2c_freq 400000

#define LCD_TP_INT GPIO_NUM_3
#define LCD_TP_RST GPIO_NUM_4
#define LCD_TP_SDA GPIO_NUM_5
#define LCD_TP_SCL GPIO_NUM_6

#define LCD_BLK GPIO_NUM_2
#define LCD_RST GPIO_NUM_8
#define LCD_SPI_CS GPIO_NUM_10


#define LCD_DRIVER_ST77903

#ifdef LCD_DRIVER_ST77903
	#define LCD_PIN_CS 10
	#define LCD_PIN_CLK 12
	#define LCD_PIN_D0 11
	#define LCD_PIN_D1 13
	#define LCD_PIN_D2 14
	#define LCD_PIN_D3 9
	#define LCD_PIN_TE 7
	#define LCD_SCREEN_SIZE 400
#endif


#define LOCATION_5N31_UART UART_NUM_2
#define LOCATION_5N31_RX_PIN GPIO_NUM_18
#define LOCATION_5N31_TX_PIN GPIO_NUM_17
#define LOCATION_5N31_PPS_PIN GPIO_NUM_1

#define HIGH 1
#define LOW 0

#define LCD_SPI_MODE 0    // 0=轮询 1=中断
#define ESP_WIFI_RELOAD 1 // wifi重载模式

#define LV_HOR_RES_MAX 400
#define LV_VER_RES_MAX 400

#define DISP_BUF_SIZE (LV_HOR_RES_MAX * LV_VER_RES_MAX * 2)

#define LV_TICK_PERIOD_MS 10

#endif // MAIN_USERCFG_H
